package ex3.executor;

import java.util.Random;

public class Operation {

	@SuppressWarnings("unused")
	private static Random rand = new Random();

	public static String doOp(char op, int a, int b) {
//		try {
//			Thread.sleep((long) Math.abs(rand.nextDouble() * 3000));
//		} catch (InterruptedException ie) {
//		}
		switch (op) {
		case '+':
			return String.valueOf(a + b);
		case '-':
			return String.valueOf(a - b);
		case 'x':
			return String.valueOf(a * b);
		case '/':
			return String.valueOf(a / b);
		case 'a':
			return String.valueOf(a + b / a);
		case 'b':
			return String.valueOf(a / b + b);
		case 'c':
			return String.valueOf(a * b / (a + b));
		case 'd':
			return String.valueOf(2 * a - b);
		case 'e':
			return String.valueOf(10 * a * a * a / (b * b));
		case 'f':
			return String.valueOf(a - a * b / (b - b * a));
		default:
			throw new IllegalArgumentException();
		}
	}
}
